<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Playbook - SnapshotSupport</title>
    <link rel="stylesheet" type="text/css" href="https://playbook-ui.github.io/playbook-ios/all.css" media="all" />
</head>
<body>
    <header>
        <a href="https://playbook-ui.github.io/playbook-ios">
            <strong>
                Playbook
            </strong>
            <span>Documentation</span>
        </a>
    </header>

    <!--
    <form class="search">
        <input type="search" placeholder="Search" />
    </form>
    -->

    <nav>
        <div class="wrapper">
            <h2>On This Page</h2>
            <ol><li><a href="#relationships">Relationships</a><ul><li><a href="#relationships">Nested Types</a></li></ul></li><li><a href="#methods">Methods</a><ul><li class="function"><a href="#snapshotsupport.data(for:on:format:scale:keywindow:viewpreprocessor:handler:)">data(for:​on:​format:​scale:​key​Window:​view​Preprocessor:​handler:​)</a></li><li class="function"><a href="#snapshotsupport.image(for:on:scale:keywindow:viewpreprocessor:handler:)">image(for:​on:​scale:​key​Window:​view​Preprocessor:​handler:​)</a></li></ul></li></ol>
        </div>
    </nav>

    <main>
        <article>
            <h1>
    <small>Enumeration</small>
    <code class="name">Snapshot​Support</code>
</h1>

<div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">enum</span> <span class="type">SnapshotSupport</span>  </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
    <p>A namespace for the methods supporting to generate snapshot from scenarios.</p>

</div>
<section id="relationships">
    <h2 hidden>Relationships</h2>
        
        <h3>Nested Types</h3>
<dl>
    <dt class="enumeration"><code><a href="https://playbook-ui.github.io/playbook-ios/SnapshotSupport_ImageFormat">SnapshotSupport.ImageFormat</a></code></dt>
<dd><p>The image format of the exported file.</p>
</dd>
</dl>
</section>
    <section id="methods">
        <h2>Methods</h2>

        <div role="article" class="function" id="snapshotsupport.data(for:on:format:scale:keywindow:viewpreprocessor:handler:)">
    <h3>
        <code><a href="#snapshotsupport.data(for:on:format:scale:keywindow:viewpreprocessor:handler:)">data(for:​on:​format:​scale:​key​Window:​view​Preprocessor:​handler:​)</a></code>
    </h3>
    <div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">func</span> <span class="function">data</span>(
        <span class="variable">for</span> <span class="variable">scenario</span>: <a href="https://playbook-ui.github.io/playbook-ios/Scenario"><span class="type">Scenario</span></a>,
        <span class="variable">on</span> <span class="variable">device</span>: <a href="https://playbook-ui.github.io/playbook-ios/SnapshotDevice"><span class="type">SnapshotDevice</span></a>,
        <span class="variable">format</span>: <span class="type">ImageFormat</span>,
        <span class="variable">scale</span>: <span class="type">CGFloat</span> = <span class="variable">UIScreen</span>.<span class="variable">main</span>.<span class="variable">scale</span>,
        <span class="variable">keyWindow</span>: <span class="type">UIWindow</span>? = <span class="keyword">nil</span>,
        <span class="variable">viewPreprocessor</span>: ((<span class="type">UIView</span>) -&gt; <span class="type">UIView</span>)? = <span class="keyword">nil</span>,
        <span class="variable">handler</span>: <span class="attribute">@</span><span class="attribute">escaping</span> (<span class="type">Data</span>) -&gt; <span class="type">Void</span>
    )  </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
    <p>Generates an image file data that snapshots the given scenario.</p>

</div>
<div class="discussion">
    <aside class="note" title="Note">
    <p>Passing the key window adds the scenario content to the view hierarchy and actually renders it, so producing a more accurate snapshot image.</p>

</aside>
</div>
<h4>Parameters</h4>

<table class="parameters">
  <thead hidden>
  <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
  </tr>
  </thead>
  <tbody>
    <tr>
    <th>scenario</th>
    <td><code class="type">Scenario</code></td>
    <td><p>A scenario to be snapshot.</p>
</td>
</tr>
<tr>
    <th>device</th>
    <td><code class="type">Snapshot​Device</code></td>
    <td><p>A snapshot environment simulating device.</p>
</td>
</tr>
<tr>
    <th>format</th>
    <td><code class="type">Image​Format</code></td>
    <td><p>An image file format of exported data.</p>
</td>
</tr>
<tr>
    <th>scale</th>
    <td><code class="type">CGFloat</code></td>
    <td><p>A rendering scale of the snapshot image.</p>
</td>
</tr>
<tr>
    <th>key​Window</th>
    <td><code class="type">UIWindow?</code></td>
    <td><p>The key window of the application.</p>
</td>
</tr>
<tr>
    <th>handler</th>
    <td><code class="type">@escaping (Data) -&gt; Void</code></td>
    <td><p>A closure that to handle generated data.</p>
</td>
</tr>
<tr>
    <th>view​Preprocessor</th>
    <td><code class="type">((UIView) -&gt; UIView)?</code></td>
    <td><p>A closure to preprocess scenario UIView before generating snapshot.</p>
</td>
</tr>
  </tbody>
</table>
</div>
<div role="article" class="function" id="snapshotsupport.image(for:on:scale:keywindow:viewpreprocessor:handler:)">
    <h3>
        <code><a href="#snapshotsupport.image(for:on:scale:keywindow:viewpreprocessor:handler:)">image(for:​on:​scale:​key​Window:​view​Preprocessor:​handler:​)</a></code>
    </h3>
    <div class="declaration">
<pre class="highlight"><code><html><body><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">func</span> <span class="function">image</span>(
        <span class="variable">for</span> <span class="variable">scenario</span>: <a href="https://playbook-ui.github.io/playbook-ios/Scenario"><span class="type">Scenario</span></a>,
        <span class="variable">on</span> <span class="variable">device</span>: <a href="https://playbook-ui.github.io/playbook-ios/SnapshotDevice"><span class="type">SnapshotDevice</span></a>,
        <span class="variable">scale</span>: <span class="type">CGFloat</span> = <span class="variable">UIScreen</span>.<span class="variable">main</span>.<span class="variable">scale</span>,
        <span class="variable">keyWindow</span>: <span class="type">UIWindow</span>? = <span class="keyword">nil</span>,
        <span class="variable">viewPreprocessor</span>: ((<span class="type">UIView</span>) -&gt; <span class="type">UIView</span>)? = <span class="keyword">nil</span>,
        <span class="variable">handler</span>: <span class="attribute">@</span><span class="attribute">escaping</span> (<span class="type">UIImage</span>) -&gt; <span class="type">Void</span>
    )  </body></html></code></pre>
</div>
<div class="summary" role="doc-abstract">
    <p>Generates an <code>UIImage</code> that snapshots the given scenario.</p>

</div>
<div class="discussion">
    <aside class="note" title="Note">
    <p>Passing the key window adds the scenario content to the view hierarchy and actually renders it, so producing a more accurate snapshot image.</p>

</aside>
</div>
<h4>Parameters</h4>

<table class="parameters">
  <thead hidden>
  <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Description</th>
  </tr>
  </thead>
  <tbody>
    <tr>
    <th>scenario</th>
    <td><code class="type">Scenario</code></td>
    <td><p>A scenario to be snapshot.</p>
</td>
</tr>
<tr>
    <th>device</th>
    <td><code class="type">Snapshot​Device</code></td>
    <td><p>A snapshot environment simulating device.</p>
</td>
</tr>
<tr>
    <th>scale</th>
    <td><code class="type">CGFloat</code></td>
    <td><p>A rendering scale of the snapshot image.</p>
</td>
</tr>
<tr>
    <th>key​Window</th>
    <td><code class="type">UIWindow?</code></td>
    <td><p>The key window of the application.</p>
</td>
</tr>
<tr>
    <th>handler</th>
    <td><code class="type">@escaping (UIImage) -&gt; Void</code></td>
    <td><p>A closure that to handle generated <code>UIImage</code>.</p>
</td>
</tr>
<tr>
    <th>view​Preprocessor</th>
    <td><code class="type">((UIView) -&gt; UIView)?</code></td>
    <td><p>A closure to preprocess scenario UIView before generating snapshot.</p>
</td>
</tr>
  </tbody>
</table>
</div>
    </section>



        </article>
    </main>

    <footer>
        <p>
    Generated on <time datetime="2021-08-25T19:01:53+0900">August 25, 2021</time> using <a href="https://github.com/SwiftDocOrg/swift-doc">swift-doc</a> <span class="version">1.0.0-rc.1</span>.
</p>
    </footer>
</body>
</html>
